// 配置electorn的主进程
const { app, BrowserWindow } = require('electron')
const path = require('path')
const url = require('url')
const isDev = require('electron-is-dev')
let mainWindow
function createWindow () {
    mainWindow = new BrowserWindow({
        width: 900,
        height: 680,
        webPreferences: {
        nodeIntegration: true
        }
    })
    mainWindow.loadURL(
        isDev
        ? 'http://localhost:9999'
        : url.format({
            pathname: path.join(__dirname, '../build/index.html'),
            protocol: 'file:',
            slashes: true
            })
    )
    mainWindow.on('closed', () => (mainWindow = null))
}